<?php 
include ("include/include.php.inc");
//include("connect_db.php");

html_header("Tickets");

list($status, $user) = auth_get_status();
$username=$user['username'];

echo "<div class='box'>\n"; 
echo " <div class='boxtop'><div></div></div>\n"; 
echo "  <div class='boxcontent'>\n"; 


echo "<p align=\"left\" ><h3>Closed Tickets:</h3></p>";
echo "<!-- <p align=\"right\">Date: <?php print date( \'l d F\' )?></p> -->";


/*   $backlink=getenv('HTTP_REFERER');*/
   $client_ip=getenv('REMOTE_ADDR');

   $result = mysql_query( "SELECT tic_no,tic_user,DATE_FORMAT(tic_date,'%d/%m/%y') AS mtic_date,DATE_FORMAT(tic_time,'%T') AS mtic_time, tic_problem, tic_solution, DATE_FORMAT(tic_pro_date,'%d/%m/%y') AS mtic_pro_date,DATE_FORMAT(tic_pro_time,'%T') AS mtic_pro_time FROM chd_tickets WHERE tic_status='C' AND tic_user='$username'")
           or die("SELECT Error: ".mysql_error());

           $num_rows = mysql_num_rows($result);

           print "<TABLE width=\"100%\" bgcolor=\"#336699\" BORDER=\"0\" bordercolor=\"#FFFFFF\"><tr>";
           print "<th width=\"11%\" >Ticket#</th>";
		   print "<th width=\"10%\" >Opened</th>";
		   print "<th width=\"22%\" >Closed</th>";
		   print "<th width=\"32%\" >Problem</th>";
		   print "<th width=\"22%\" >Solution</th>";
		   print "<th width=\"3%\"  ></th></tr>";

           while ($row = mysql_fetch_assoc($result)){
                 extract($row);
				 print "<tr><td bgcolor=\"#FFFFFF\" >$tic_no</th>";
                 print "<td bgcolor=\"#FFFFFF\" >$mtic_date-$mtic_time</td>";
				 print "<td bgcolor=\"#FFFFFF\" >$mtic_pro_date-$mtic_pro_time</td>";
                 print "<td bgcolor=\"#FFFFFF\" >$tic_problem</td>";
                 print "<td bgcolor=\"#FFFFFF\" >$tic_solution</td>";
                 /*print "<td><a href=\"edit_ticket.php?cmd=edit&tic_no=$tic_no\"><IMG src=\"../images/edit.gif\"></a></td>";*/
                 print "<td bgcolor=\"#FFFFFF\" ><a href=\"del_ticket.php?cmd=del&tic_no=$tic_no\"><IMG src=\"css/images/del.gif\"></a></td></tr>";
                 }

                 print "</table>\n";
                 print "<br>";print "<br>";
				 

echo "  </div>\n"; 
echo " <div class='boxbottom'><div></div></div>\n"; 
echo "</div>\n"; 

   html_footer();
?>